<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/scroll.css">
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/detail.css">
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/components.css">
<script src="__TEMP__/{$style}/public/js/scroll.js" type="text/javascript"></script>
<script type="text/javascript" src="__TEMP__/{$style}/public/js/touchslider.js"></script>
<script src="__TEMP__/{$style}/public/js/countdown.js" type="text/javascript"></script>
<style>
.address-select{width: 30%;float: left;border: 1px solid #e5e5e5;height: 20px;line-height: 20px;margin: 5px 15px;margin-left: 0;}
.give-the-thumbs-up{position: absolute;top: 0px;right: 10px;text-align: center;font-size: 12px;margin-top: 13px;}
.give-the-thumbs-up i{font-size: 21px;}
input{appearance:none;-moz-appearance:none;-webkit-appearance:none;outline: none;-moz-outline: none;-webkit-outline: none;}
.number{border-radius: 0;-webkit-border-radius: 0;}
.favorites,.share{width: 30px;height: 30px;text-align: center;line-height: 30px;background: rgba(0,0,0,0.6);border-radius: 50%;position: absolute;z-index: 1005;right: 8px;top: 10px;}
.share{right: 45px}
.favorites i,.share i{color: #eee;margin-top: 9px;}
.shop_slider .bar{background: none;}
.comment_img{width: 80px;height: 80px;margin:0 5px 5px 0;display: inline-block;float: left;line-height: 80px;text-align: center;}
.comment_img img{max-width: 100%;max-height: 100%;vertical-align: middle;height: auto;}
/* 幻灯片 */
#img-slider{display:none;}
#img-slider ul li{text-align:center;}
#img-slider li a{display:block;width:100%;height:100%;}
#img-slider li img{max-width:100%;max-height:100%;vertical-align: middle;}
#img-slider .img-count{position: fixed;top:5%;left:0;right:0;width:100%;text-align:center;color:#9E9E9E;}
.jiantou{float: right;width: 15px;height: 15px;background:url("__TEMP__/{$style}/public/images/assistant_right.png") no-repeat center;background-size: auto 15px;margin-top: 3px;}
.user_info .name-box{width: 100%;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}
.mark_title{background: rgba(0,0,0,0);border: 1px solid #ff0000; color: #ff0000;padding: 1px 5px;border-radius: 3px;font-size: 12px;}
.share_img{position:fixed;top:0;right:0;z-index:99999;display:none;background:#000;opacity:0.8;filter:alpha(opacity=80);width:100%;height:100%;text-align:right;}
.share_img p{color:#fff;line-height:30px;font-size:16px;}
#banner{position:relative;}
.goods-video-box{width:100%;top:0px;display:none;height:320px;line-height:320px;background-color:#000;}
.goods-video-box video{width:100%;height:auto;max-height:100%;vertical-align:middle;}
.goods-alter{padding:4px 0px;position:absolute;left:0px;right:0px;top:13px;text-align:center;z-index:12;font-size:12px;z-index:1005;margin: 0 20%}
.goods-alter span{background-color:rgba(255,255,255,1);padding:2px 10px;border-radius:10px;}
.goods-alter span.on{background:orange;color:#fff;}
.goods-alter-video{margin-right:6px;} 
video::-webkit-media-controls-enclosure {overflow:hidden;}
video::-webkit-media-controls-panel {width: calc(100% + 50px);}
#store_service img{width:20px;height:20px;margin-right:5px;}
#shop_service img{width: 22px;height: 23px;margin-right: 10px;padding-left: 1px;}
#shop_service span{color:#051b28;}
.goods-unit-style{color: #F44;font-size: 20px;display: inline-block;font-weight: normal;}
</style>
<div data-exp="goods"></div>
<section id="banner">
	<div class="shop_slider shop_slider_auto" data-tag="module-slider" data-height="320px" id="goods-image-box">
		<div class="inner" data-tag="slider-warp" >
			<ul class="pic_list" data-tag="slider-list">
			{foreach name = "goods_detail['img_list']" item = 'img_list' key='key' }
				<li style="width: 100%;">
					<div>
						<img alt="{:lang('goods_picture')}" class="pp_init_img" src="{:__IMG($img_list['pic_cover_big'])}" data-index="{$key}" {if $key > 0}style="display:none;"{/if}/>
					</div>
				</li>
			{/foreach}
			</ul>
			<!-- 收藏商品 -->
			{if condition="$is_member_fav_goods == 0"}
			<div class="favorites" onclick="collectionGoods({$goods_detail.goods_id},'goods','{$goods_detail.goods_name}',this);" data-log-id="{$is_member_fav_goods}">
				<i class="fa fa-heart-o" aria-hidden="true"></i>
			</div>
			{else/}
			<div class="favorites" onclick="collectionGoods({$goods_detail.goods_id},'goods','{$goods_detail.goods_name}',this);" data-log-id="{$is_member_fav_goods}">
				<i class="fa fa-heart" aria-hidden="true"></i>
			</div>
			{/if}
			{if condition="$isWeixin eq 1"}
			<div class="share" onclick="document.getElementById('share_img').style.display='block';">
				<i class="fa fa-share" aria-hidden="true"></i>
			</div>
			{/if}
			
		</div>
		<div class="bar_wrap">
			<ul class="bar" data-tag="slider-page">
				<li class="cur"></li>
				<li></li>
				<li></li>
			</ul>
		</div>
	</div>
	
	{if condition="!empty($goods_detail['goods_video_address'])"}
	
		<div class="goods-alter" >
			<span class="goods-alter-video">视频</span>
			<span class="goods-alter-image on">图片</span>
		</div>
		
		<div class="goods-video-box">
			<video loop controls>	
				<source src="{:__IMG($goods_detail.goods_video_address)}" type="video/mp4" />
			</video>
		</div>
	{/if}
	
	
</section>

<div class="buy_area">
	<div class="fn_wrap" style="position: relative;">
		<h1 class="title" id="itemName" style="width: 85%;">
			{notempty name="goods_group_list"}
				{volist name="goods_group_list" id="vo"} 
					<i class="goods_tab">{$vo.group_name}</i>
				{/volist}
			{/notempty}
		{$goods_detail.goods_name}
		</h1>
		<p class="goods-introduction">{$goods_detail.introduction}</p>
		<span class="give-the-thumbs-up" onclick="document.getElementById('share_img').style.display='block';">
			<i class="data-icon-share"></i><br/>{:lang('share')}
		</span>
		
	</div>
	
	<div class="price_wrap">
		<span class="tit" id="priceTitle"></span> 
		<span class="price" price="{$goods_detail.promotion_price}">
			<span style="font-size:14px;display: inline-block;vertical-align: middle;">￥{$goods_detail.point_exchange} {:lang('goods_integral')}</span>
		</span>
		<span class="flag" id="priceDis" style="display: none"></span>
	</div>
	
	{if condition="$goods_detail.max_buy>0"}
	<hr class="with-margin-l" />
	<hr class="divider-line" />
	<div class="price_postage">
		<span class="price_postage_tit">
		<i style="color: #fff;font-size: 12px;padding: 1px 3px;background: #f44;border-radius: 2px;">{:lang('goods_quantity_purchased')}</i>&nbsp;{$goods_detail.max_buy}{:lang('goods_individual')}</span>
	</div>
	{/if}
	<hr class="with-margin-l" />
	<div class="stock-detail" >
		<span>销量：{$goods_detail['sales']}笔</span>
		<span class="js-shipping-fee-name">运费：0.00</span><!-- 运费 -->
		<span>点击：{$goods_detail.clicks}</span>
	</div>
</div>
<hr class="with-margin-l" />
<hr class="divider-line" />
{if condition = "$goods_detail['mansong_name'] neq ''"}
<div class="price_postage">
	<span class="price_postage_tit js-reduced-send single"><i style="color: #fff;font-size: 12px;padding: 1px 3px;background: #f44;border-radius: 2px;">{:lang('member_full')}{:lang('member_reduce')}</i>&nbsp;{$goods_detail['mansong_name']}</span>
</div>
<hr class="with-margin-l" />
{/if}
<!-- 阶梯优惠 -->
{notempty name="goodsLadderPreferentialList"}
<div class="price_postage" id="ladder_preferential">
	<span class="price_postage_tit js-reduced-send single"><i style="color: #fff;font-size: 12px;padding: 1px 3px;background: #f44;border-radius: 2px;">{:lang('ladder_preferential')}</i>
			满<b style="color: red;">{$goodsLadderPreferentialList.0.quantity}</b>{if condition ='empty($goods_detail.goods_unit)'}件{else/}{$goods_detail.goods_unit}{/if},每{if condition ='empty($goods_detail.goods_unit)'}件{else/}{$goods_detail.goods_unit}{/if}降<b style="color: red;">{$goodsLadderPreferentialList.0.price}</b>元
		<i class="jiantou"></i>
	</span>
</div>
<hr class="with-margin-l">
{/notempty}

{if condition="$goods_detail.goods_type == 1"}
	<!-- 实物商品参加包邮活动 -->
	{if condition = "$goods_detail['baoyou_name'] neq ''"}
	<div class="price_postage">
		<span class="price_postage_tit single"><i style="color: #fff;font-size: 12px;padding: 1px 3px;background: #f44;border-radius: 2px;">{:lang('goods_free_shipping')}</i>&nbsp;{$goods_detail['baoyou_name']}</span>
	</div>
	<hr class="with-margin-l" />
	{/if}
{/if}

<!-- 领取优惠劵 -->
{notempty name="$goods_coupon_list"}
<div class="price_postage" id="receive_coupons">
	<span class="price_postage_tit single"><i style="color: #fff;font-size: 12px;padding: 1px 3px;background: #f44;border-radius: 2px;">领券</i>&nbsp;领取优惠劵<i class="jiantou"></i></span>
</div>
<hr class="with-margin-l" />
{/notempty}

<div class="price_postage" id="theSelected">
	<span style="float: left;">已选择</span>
	<span class="selected"></span>
	<i class="jiantou"></i>
</div>
<hr class="with-margin-l">
{if $goods_detail.is_open_presell == 1}
<div class="price_postage">
	<span>{:lang('goods_delivery_time')}</span>
	<span style="padding-left: 5px;">
		{if condition ="$goods_detail.presell_delivery_type eq 1"}
			{:getTimeStampTurnTime($goods_detail.presell_time)}发货
		{else/}
			付款{$goods_detail.presell_day}后发货
		{/if}
	</span>
</div>
<hr class="with-margin-l">
{/if}
<div class="price_postage">
	<span>服务</span>
	<span style="padding-left: 5px;">由<a href="javascript:;" style="color:#333;">{$title}</a>发货并提供售后服务</span>
</div>
<hr class="with-margin-l">

<!-- 商家服务 -->
{if !empty($existingMerchant)}
<div class="price_postage" id="store_service">
	{foreach name="existingMerchant" item="vo" key="k"}
		{if $k < 4}
			<span>{$vo.title}</span>
		{/if}
	{/foreach}
	<i class="jiantou"></i>
</div>
<hr class="with-margin-l">
{/if}

{if condition = "$goods_detail['give_point'] neq 0"}
<div class="price_postage">
	<span class="price_postage_tit"><i class="fa fa-database" style="color: #F44;margin-right: 5px;"></i>{:lang('goods_gift_points')}<span style="color:#F44;padding:0;">{$goods_detail['give_point']}</span>{:lang('minutes')}</span>
</div>
<hr class="with-margin-l" />
{/if}

<!-- 积分抵现 -->
{if condition ="$integral_balance > 0"}
<div class="price_postage">
	<span class="price_postage_tit">购买本商品积分可抵{$integral_balance}元</span>
</div>
<hr class="with-margin-l" />
{/if}

{if condition="$goods_detail.group_info != ''"}
    <div class="price_postage" style="display: block;">
		<a href="{:__URL('APP_MAIN/goods/grouppurchase','id='.$goods_detail['goods_id'])}">
			<span class="selected">&nbsp;去团购</span>
			<i class="jiantou"></i>
		</a>
	</div>
{/if}
<!-- 商品组合套餐 -->
{notempty name="comboPackageGoodsArray"}
<hr class="divider-line" />
<a href="{:__URL('APP_MAIN/goods/comboPackageList','goodsid='.$comboPackageGoodsArray['main_goods']['goods_id'])}" >
	<div class="price_postage">
		<span class="price_postage_tit single">{:lang("combo_package")}<i class="jiantou"></i></span>
	</div>
</a>
<div class="combo_package">
	<div class="combo_package_goods">
		<div class="goods">
			<a href="{:__URL('APP_MAIN/goods/goodsdetail','id='.$comboPackageGoodsArray['main_goods']['goods_id'])}">
				<img src="{:__IMG($default_goods_img)}" class="lazy_load g-img" data-original="{:__IMG($comboPackageGoodsArray['main_goods']['pic_cover_mid'])}" alt="">
				<p class="g-price">￥{$comboPackageGoodsArray.main_goods.price}</p>
			</a>
		</div>
		<i class="fa fa-plus" aria-hidden="true"></i>
		{foreach name="$comboPackageGoodsArray['goods_array']" item="vo" key = "k"}
			{if condition="$k < 2"}
			<div class="goods" style="margin-right: 5%;">
				<a href="{:__URL('APP_MAIN/goods/goodsdetail','id='.$vo['goods_id'])}">
					<img src="{:__IMG($default_goods_img)}" class="lazy_load g-img" data-original="{:__IMG($vo['pic_cover_mid'])}" alt="">
					<p class="g-price">￥{$vo['price']}</p>
				</a>
			</div>
			{/if}
		{/foreach}
	</div>
</div>
{/notempty}



	
<!-- 商品评价 -->
{if $evaluates_count['evaluate_count'] > 0}
	<hr class="divider-line" />
	<div data-exp="comment"></div>
	{include file="wap/default_new/Goods/controlGoodEvaluate" /}
{/if}
<!-- 店铺信息 -->
<hr class="divider-line" />
<div class="statistics">
		<div class="app-field clearfix">
			<div class="control-group">
				<div class="custom-store block-item">
					<a class="custom-store-link clearfix" href="{:__URL('APP_MAIN/shop/index?shop_id='.$goods_detail['shop_id'])}">
						<div class="custom-store-img"></div>
						<div class="custom-store-name">{$goods_detail.shop_name}</div>
						<div class="custom-store-enter">进入店铺</div>
					</a>
				</div>
				<div class="component-border"></div>
			</div>
			<div class="sort">
				<i class="sort-handler"></i>
			</div>
		</div>
		<hr class="with-margin-l" /> 

		<div class="price_postage">
			<span class="price_postage_tit">
				<img src="__TEMP__/{$style}/public/images/pro_detail_shop.jpg"/>
				<span style="font-size: 12px;" >企业认证</span>
				<img src="__TEMP__/{$style}/public/images/pro_detail_shop.jpg"/>
				<span >担保交易</span>
				<img src="__TEMP__/{$style}/public/images/pro_detail_shop.jpg"/>
				<span class="rz-name font-size-12 c-gray-darker">线下门店</span>
			</span>
		</div>
		
	</div>		
<!-- 商品属性 -->
{if condition = "!empty($goods_detail['goods_attribute_list'])"}
<hr class="divider-line">
<div class="tab-module-title">{:lang('goods_commodity_attribute')}</div>
<hr class="with-margin-l">
<div class="detail_info_wrap p-attribute" id="p-attribute">
	<ul class="attribute-ul">
		{foreach $goods_detail["goods_attribute_list"] as $vo}
			{notempty name="$vo['attr_value_name']"}
			<li>
				<em>{$vo.attr_value}：</em>
				<span id="goods_attr_" title="{$vo.attr_value_name}" class="goods-attr-value">{$vo.attr_value_name}</span>
			</li>
			{/notempty}
		{/foreach}
	</ul>
</div>
{/if}

<hr class="divider-line">
<div data-exp="goodsdetail"></div>
<!-- 商品详情 -->
<div class="tab-module-title">{:lang('goods_commodity_details')}</div>
<hr class="with-margin-l">
<div class="detail_info_wrap" id="p-detail">
	<div class="detail_list" id="content">{$goods_detail.description}</div>
</div>

	
{include file="wap/default_new/controlCopyRight"}
<!-- 弹出框 -->
<div class="success-tip-line" id="success_tip_line" style="display: none;">{:lang('successfully_joined_shopping_cart')}！</div>
<div class="mask" id="mask" style="display: none;"></div>
<span id="addcart_way" style="display: none;"><i></i></span>
<section class="s-buy" id="s_buy">
	<div class="popup"  id="popup" style="-webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px;display: none"></div>
	<ul class="s-buy-ul">
		<li class="s-buy-pro">
			<span class="pro-img">
			
				<!-- 商品SKU图片 -->
				{notempty name="$goods_detail['sku_picture_list']"}
				
					{foreach name="$goods_detail.sku_picture_list" item ="img" }
					
						{foreach name="$img['album_picture_list']" item="p" key = "k"}
							<input type="hidden" id="spec_picture_id{$p['pic_id']}" value="{:__IMG($p['pic_cover_small'])}" />
						{/foreach}
						
					{/foreach}
				
				{/notempty}
				
				<input type="hidden" id="default_img" value="{$goods_detail['img_list'][0]['pic_id']}" />
				<img src="{:__IMG($goods_detail['img_list'][0]['pic_cover_small'])}" class="js-thumbnail">
				
			</span>
			<div class="pro-info">
				<p class="name" >{$goods_detail.goods_name}</p>
				<p class="pro-price" >
					<span id="price" style="font-size:16px;display: inline-block;vertical-align: middle;">{$goods_detail.point_exchange} {:lang('goods_integral')}</span>
				</p>
			</div>
			<i class="icon-close" id="icon_close"></i>
		</li>
	</ul>
	<hr class="with-margin-l" />
	<ul class="s-buy-ul specification" id="specification" style="z-index: 9000;">
		{foreach name="goods_detail['spec_list']" item="spec" key="k"}
		<li class="s-buy-li" >
			<div class="left">{$spec.spec_name}：</div>
			<div class="right" name="specvals" >
			{foreach name="spec['value']" item="spec_value" key="child_k"}
				{if condition="$spec_value['spec_id'] eq $spec['spec_id']"}
					<button class="select {if condition="$child_k==0"}current{/if}" name="Span{$k}" id="{$spec_value.spec_id}:{$spec_value.spec_value_id}" onclick="change(this);" data-picture-id="{$spec_value.picture}">{$spec_value.spec_value_name}</button>
				{/if}
			{/foreach}
			</div>
		</li>
		<hr class="with-margin-l" />
		{/foreach}
		{foreach name="goods_detail['sku_list']" item="pro_skus" key="k"}
		<input type="hidden" id="goods_sku{$k}" value="{$pro_skus.attr_value_items}" stock="{$pro_skus.stock}" {if condition="$pro_skus.promote_price < $pro_skus.member_price" }price="{$pro_skus.promote_price}" {else/}price="{$pro_skus.member_price}"{/if} promotion_price="{$pro_skus.promote_price}" member_price="{$pro_skus.member_price}" skuid="{$pro_skus.sku_id}" skuname="{$pro_skus.sku_name}" class="sku-array">
		{/foreach}
<!-- 		<input type="hidden" id="goods_sku_num" value="100"> -->
		<li class="s-buy-li">
			<div class="left" style="float:left;">{:lang('member_quantity_purchased')}：</div>
			<div class="right">
				<span class="reduce quantity-minus-disabled">-</span>
				<input class="number" name="quantity" autocomplete="off" value="{if condition='$goods_detail.min_buy !=0'}{$goods_detail.min_buy}{else/}1{/if}" min="{if condition='$goods_detail.min_buy !=0'}{$goods_detail.min_buy}{else/}1{/if}" max="{$goods_detail.stock}" id="num" />
				<span class="add">+</span>
			</div>
			{if condition="$goods_detail.is_stock_visible == 1"}
			<span style="display: inline-block;margin-top:5px;color:#333;" id="Stock">{:lang('left')}{$goods_detail.stock}{if condition ="empty($goods_detail['goods_unit'])"}件{else/}{$goods_detail['goods_unit']}{/if}</span>
			{/if}
			{if condition ="$goods_detail['max_buy'] neq '0' AND $goods_detail['max_buy'] neq -1"}
			<span style="display: inline-block;margin-top:5px;color:#333;">{:lang('homebuying_restrictions')}{$goods_detail['max_buy']}{if condition ="empty($goods_detail['goods_unit'])"}件{else/}{$goods_detail['goods_unit']}{/if}</span>
			{/if}
		</li>
		
	</ul>
	<ul class="s-buy-ul">
		<li class="s-buy-btn">
			<a class="btn" id="submit_ok" tag="exchange">{:lang('goods_determine')}</a>
	
			<input id="hiddPDetailID" type="hidden" value="{$goods_detail.goods_id}"/>
			<input id="hiddSkuId" type="hidden" />
			<input id="hiddSkuName" type="hidden" />
			<input id="hiddSkuprice" type="hidden" />
			<input id="hiddStock" type="hidden" value="{$goods_detail.stock}"/>
			<input type="hidden" id="hidden_shop_name" value="{$shopname}"/>
			<input type="hidden" id="hidden_shop_id" value="{$goods_detail.shop_id}"/>
			<input type="hidden" id="is_sale" value="{$goods_detail.state}" />
			<input type="hidden" id="goods_id" value="{$goods_detail.goods_id}" />
			<input type="hidden" id="code" value="{$goods_detail.code}" />
			<input type="hidden" id="max_buy" value="{$goods_detail.max_buy}" />
			<input type="hidden" id="min_buy" value="{$goods_detail.min_buy}" />
			<input type="hidden" id="hidden_current_num" value="{$num}" />
			<input type="hidden" id="hidden_uid" value="{$uid}">
			<input type="hidden" id="ms_time" value="{$ms_time}"/>
			<input type="hidden" id="hidden_presell" value="{$goods_detail.presell_price}"/>
		</li>
	</ul>
</section>
<div id="img-slider">
	<ul></ul>
	<div class="img-count">
		<b class="curr">1</b>/<b class="sum"></b>
	</div>
</div>

<!-- 领取优惠劵弹出框 -->
<div class="bottom_popup"  data-popup-type="receive_coupons">
	<div class="bottom_popup_title">
		领取优惠劵
	</div>
	<ul class="coupon_list">
		{notempty name="$goods_coupon_list"}
			{volist name="goods_coupon_list" id="vo"}
			<li>
				<div class="js-coupon" data-max-fetch="{$vo.max_fetch}" data-receive-quantity="{$vo.receive_quantity}" data-coupon-id="{$vo.coupon_type_id}">
					<div class="coupon-price">
						<p class="price">￥{$vo.money}</p>
						<p class="desc">立即领取</p>
					</div>
					<div class="coupon-lose">
						<p class="condition">{$vo.money}元优惠券，满{$vo.at_least}可用</p>
						<p class="time">
							<span>{$vo.start_time|date="Y-m-d",###}</span>至<span>{$vo.end_time|date="Y-m-d",###}</span>
						</p>
					</div>
				</div>
			</li>
			{/volist}
		{/notempty}
	</ul>
	<div class="bottom_popup_button" id="complete"> 
		<span>完成</span>
	</div>
</div>

<!-- 阶梯优惠信息弹出框 -->
<div class="bottom_popup"  data-popup-type="ladder_preferential">
	<div class="bottom_popup_title">
		{:lang("ladder_preferential")}
	</div>
	<ul class="coupon_list">
		<mark class="mark_title">{:lang("ladder_preferential")}</mark>
		{foreach name="goodsLadderPreferentialList" item="vo"}
			满<b style="color: red;">{$vo.quantity}</b>{if condition ='empty($goods_detail.goods_unit)'}件{else/}{$goods_detail.goods_unit}{/if},每{if condition ='empty($goods_detail.goods_unit)'}件{else/}{$goods_detail.goods_unit}{/if}降<b style="color: red;">{$vo.price}</b>元&nbsp;&nbsp;
		{/foreach}
	</ul>
	<div class="bottom_popup_button" id="complete"> 
		<span>完成</span>
	</div>
</div>

<!-- 分享弹框 -->
<div id="share_img" class="share_img" onclick="document.getElementById('share_img').style.display='none';">
    <p><img class="arrow" src="__TEMP__/{$style}/public/images/goods_share.png"></p>
    <p style="margin-top:30px; margin-right:50px;">点击右上角</p>
    <p style="margin-right:50px;">将此商品分享给好友</p>
</div>

<!-- 商家服务 -->
<div class="bottom_popup"  data-popup-type="store_service">
	<div class="bottom_popup_title">
		{:lang('merchant_service')}
	</div>
	<ul class="coupon_list" id="shop_service">
		{notempty name="$existingMerchant"}
			{foreach name="$existingMerchant" item="vo"}
			<li>
				{if condition="$vo.pic eq ''"}
				<p class="service_title">{$vo.title}</p>
				{else/}
				<img src="{$vo.pic}"/><span>{$vo.title}</span>
				{/if}
				<p class="service_desc">{$vo.describe}</p>
			</li>
			{/foreach}
		{/notempty}
	</ul>
	<div class="bottom_popup_button" id="complete"> 
		<span>完成</span>
	</div>
</div>
<!-- 领取优惠劵弹出框 -->
<div class="bottom_popup"  data-popup-type="receive_coupons">
	<div class="bottom_popup_title">
		领取优惠劵
	</div>
	<ul class="coupon_list">
		{notempty name="$goods_coupon_list"}
			{volist name="goods_coupon_list" id="vo"}
			<li>
				<div class="js-coupon" data-max-fetch="{$vo.max_fetch}" data-receive-quantity="{$vo.receive_quantity}" data-coupon-id="{$vo.coupon_type_id}">
					<div class="coupon-price">
						<p class="price">￥{$vo.money}</p>
						<p class="desc">立即领取</p>
					</div>
					<div class="coupon-lose">
						<p class="condition">{$vo.money}元优惠券，满{$vo.at_least}可用</p>
						<p class="time">
							<span>{$vo.start_time|date="Y-m-d",###}</span>至<span>{$vo.end_time|date="Y-m-d",###}</span>
						</p>
					</div>
				</div>
			</li>
			{/volist}
		{/notempty}
	</ul>
	<div class="bottom_popup_button" id="complete"> 
		<span>完成</span>
	</div>
</div>
<!-- 图片放大 -->
{include file="wap/default_new/Goods/controlPhotoSwipe" /}

<script type="text/javascript">
var goods_unit = "{if condition ='empty($goods_detail.goods_unit)'}件{else/}{$goods_detail.goods_unit}{/if}";

$(function () {
	var openPhotoSwipe = function(index) {
	    var pswpElement = document.querySelectorAll('.pswp')[0];

	    var items = new Array();
		$("ul.pic_list li div img.pp_init_img").each(function(i,e){
			var theImage = new Image();
			theImage.src = $(e).attr("src");
			var info = {"src" : $(e).attr("src"), "w" : theImage.width, "h" : theImage.height};
			items.push(info);
		})


	    var options = {     
	        history: false,
	        focus: false,
	        showAnimationDuration: 0,
	        hideAnimationDuration: 0,
	        index : index
	    };

	    var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
	    gallery.init();
	};	

	$("ul.pic_list li div img.pp_init_img").bind("click",function(){
		var index = $(this).data("index");
		openPhotoSwipe(index);
	})

	countDown();//计时器
	
	//分享
	$.ajax({
		type:"post",
		data : {"shop_id" : "{$shop_id}" , "flag" : "goods" , "goods_id" : "{$goods_id}"},
		url : "{:__URL('APP_MAIN/goods/getShareContents')}",
		success : function(data){
			{include file='wap/default_new/shareContents'/}
		}
	});
	
	{if condition="$goods_detail.goods_type == 1"}
	
	//定位查询运费
	$.ajax({
		type : "post",
		data :{"goods_id" : "{$goods_id}"},
		url : "{:__URL('APP_MAIN/Goods/getShippingFeeNameByLocation')}",
		success : function(data){
			if(data != ""){
				if(typeof data == "string"){
					$(".js-shipping-fee-name").text("运费：" + data);
				}else if(typeof data == "object"){
					$(".js-shipping-fee-name").text("运费：" + data[0].express_fee);
				}
			}
		}
	});
	{/if}

	$(window).scroll(function(){
		var scroll_top = $(window).scrollTop();
		if(scroll_top > 50){
			$("#DataHeadNav").css("opacity",1);
		}else{
			$("#DataHeadNav").css("opacity",0);
		}
		$("[data-exp]").each(function(i,e){
			var _postTop = $(this).offset().top;
			if(scroll_top > _postTop - 55){
				$("#DataHeadNav .heav-nav li").removeClass("current");
				$("#DataHeadNav .heav-nav li").eq(i).addClass("current");
			}
		})
	})

	$("#DataHeadNav .heav-nav li").click(function(){
		var _index = $(this).index();
		var _scroll = $("[data-exp]").eq(_index).offset().top - 50;
		$("body").animate({ scrollTop: _scroll }, 100);
	})
});


//点赞
var flag = false;
function clickPoint(){
	var uid = $("#hidden_uid").val();
	if (uid != null && uid != "") {
		if(flag) return;
		flag = true;
		$.ajax({
			type:"post",
			data : {"goods_id" : "{$goods_id}"},
			url : "{:__URL('APP_MAIN/Goods/getClickPoint')}",
			success : function(data){
				if(data['code']>0) {
					$(".fa-thumbs-up").css("color","#FF8855");
				}else{
					showBox(data["message"],"error");
				};
				flag = false;
			}
		});
	}else{
		location.href = "{:__URL('APP_MAIN/Login')}";
	}
}

function showProperty(sobj,type){
	$("#detailTab span").removeClass("cur");
	$(sobj).addClass("cur");
	if(type==1){
		$("#productproperty").hide();
		$("#p-detail").show(); 
		$("#p-attribute").hide();
	}else if(type == 2){
		$("#productproperty").hide();
		$("#p-detail").hide();
		$("#p-attribute").show();
	}else{
		$("#productproperty").show();
		$("#p-detail").hide(); 
		$("#p-attribute").hide();
	}
}


var img_slider = null;
//点击显示评论大图
function showImgSlider(event){
	var parent = $(event).parent().parent();
	var html = '';
	var curr = parseInt($(event).attr("data-index"));
	parent.children("li").each(function(i){
		html += '<li style="width: ' + $(window).outerWidth() + 'px; height: ' + $(window).outerHeight() + 'px; display: table-cell; padding: 0; margin: 0; float: left;">';
			html += '<a href="javascript:;" style="display: -webkit-box;-webkit-box-align: center;-webkit-box-pack: center;">';
				html += '<img src="' + $(this).children("img").attr("src") + '">';
			html += '</a>';
		html += '</li>';
	});
	$("#img-slider ul").html(html);
	var num = parent.children("li").size();
	$('#img-slider .img-count .sum').text(num);
	$('#img-slider .img-count .curr').text(curr+1);
	if(img_slider == null){
		img_slider = new TouchSlider({id:'img-slider','auto':'-1',fx:'ease-out',direction:'left',speed:600,timeout:5000,'before':function(index){
			$('#img-slider .img-count .curr').text($("#img-slider li:eq(" + index + ")").index()+1);
		}});
	}else{
		img_slider.length = num;//对象已存在，修改图片数量即可
		$("#img-slider ul").css("width",($(window).outerWidth()*num) + "px");
	}
	$("#img-slider").show().removeAttr("data-flag");
	img_slider.specified(curr);
}

//关闭遮罩层，并给予标识
$("#img-slider").click(function(){
	$(this).hide().attr("data-flag",1);
});

/*
 * 收藏商品 
 */
var is_click = false;
function collectionGoods(fav_id, fav_type, log_msg,obj) {
	var uid = $("#hidden_uid").val();
	if (uid != null && uid != "") {
		var logid = $(obj).attr("data-log-id");
		if(is_click){
			return false;
		}
		is_click = true;
		//未收藏添加收藏
		if (logid == 0) {
			$.ajax({
				url : "{:__URL('APP_MAIN/Member/FavoritesGoodsorshop')}",
				type : "post",
				async : false,
				data : {
					"fav_id" : fav_id,
					"fav_type" : fav_type,
					"log_msg" : log_msg
				},
				success : function(data) {
					if (data.code > 0) {
						$(obj).find("i").attr("class","fa fa-heart");
						$(obj).attr("data-log-id",1);
						showBox("收藏成功","success");
					}
					is_click = false;
				}
			});
		} else {
			//已收藏取消收藏
			$.ajax({
				url : "{:__URL('APP_MAIN/Member/cancelFavorites')}",
				type : "post",
				async : false,
				data : {
					"fav_id" : fav_id,
					"fav_type" : fav_type
				},
				success : function(data) {
					if (data.code > 0) {
						$(obj).find("i").attr("class","fa fa-heart-o");
						$(obj).attr("data-log-id",0);
						showBox("取消收藏成功","success");
					}
					is_click = false;
				}
			});
		}
	} else {
		location.href = "{:__URL('APP_MAIN/Login')}";
	}
}

$(".goods-alter span").each(function(i){
	var video_url = "";
	{notempty name="$goods_detail['goods_video_address']"}
		video_url = "{:__IMG($goods_detail.goods_video_address)}";
	{/notempty}
	$(this).click(function(){
		$(this).addClass('on').siblings().removeClass('on');
		if(i == 0){
			var html = '';
			
			html += '<video autoplay loop controls>';
			  html += '<source src="'+video_url+'" type="video/mp4" />';
			html += '</video>';
			
			$(".goods-video-box").html(html);
			
			$("#goods-image-box").hide();
			$(".goods-video-box").show();
			
		}else{
			
			$(".goods-video-box").hide();
			$(".goods-video-box video").remove();
			$("#goods-image-box").show();
		}
	})
})

window.onload = function(){
	$("ul.pic_list li div img.pp_init_img").css("display","block");
}
</script>